package com.andy.infrastructure.ioc.impl;

import com.andy.infrastructure.ioc.BeanDefinition;

import java.lang.reflect.Method;

public class DefaultBeanDefinition implements BeanDefinition {

    private String name;
    private Class type;

    //工厂bean相关
    private boolean isFactoryBean;
    private Method factoryMethod;
    private String factoryBeanName;

    public DefaultBeanDefinition(String name, Class type) {
        this.name = name;
        this.type = type;
    }

    public DefaultBeanDefinition(String name, Class type, boolean isFactoryBean, Method factoryMethod, String factoryBeanName) {
        this.name = name;
        this.type = type;
        this.isFactoryBean = isFactoryBean;
        this.factoryMethod = factoryMethod;
        this.factoryBeanName = factoryBeanName;
    }

    /**
     * 获取bean定义的唯一标识名
     *
     * @return
     */
    @Override
    public String getName() {
        return name;
    }

    /**
     * 获取对象类型
     *
     * @return
     */
    @Override
    public Class getType() {
        return type;
    }

    @Override
    public boolean isFactoryBean() {
        return isFactoryBean;
    }

    @Override
    public Method getFactoryMethod() {
        return factoryMethod;
    }

    @Override
    public String getFactoryBeanName() {
        return factoryBeanName;
    }
}
